package com.dtjd.playcoinmonkey.activities;

import android.os.Bundle;
import android.view.MenuItem;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.dtjd.playcoinmonkey.R;

import com.dtjd.playcoinmonkey.databinding.ActivityPolicyBinding;

public class PolicyActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityPolicyBinding binding = ActivityPolicyBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        ActionBar actionbar = getSupportActionBar();
        if (actionbar!=null){
            actionbar.setDisplayHomeAsUpEnabled(true);
            actionbar.setHomeButtonEnabled(true);
        }
        String type = getIntent().getStringExtra("type");
        if (type.equals("Privacy")){
            binding.privacyTv.setText(R.string.privacyPolicyContent);
            setTitle(getResources().getString(R.string.privacyPolicy));
            binding.privacyTitle.setText(getResources().getString(R.string.privacyPolicy));
        }
        if (type.equals("Service")){
            binding.privacyTv.setText(R.string.serviceItemsContent);
            setTitle(getResources().getString(R.string.serviceItems));
            binding.privacyTitle.setText(getResources().getString(R.string.serviceItems));
        }
    }
    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if (android.R.id.home==item.getItemId()){ finish(); }
        return super.onOptionsItemSelected(item);
    }
}